﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Net.Sockets;
using System.Collections.Specialized;
using System.Data.OracleClient;
using System.Data.SqlClient; 
using CIMCService;

public partial class _Default : System.Web.UI.Page
{
    private string ll_pace;
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Configuration.AppSettingsReader g_getspace = new System.Configuration.AppSettingsReader();
        ll_pace = ((string)(g_getspace.GetValue("userspace", typeof(string))));
    }
    t_service.Service test = new t_service.Service();


    private string f_get_ip(string str_inv, int i_no)
    {
        string str_mac, str_ip, str_return;
        OracleCommand command;
        DataSet ds;
        command = new OracleCommand();
        ds = new DataSet();
        DatabaseController dbCenter = new DatabaseController();
        try
        {
            dbCenter.OpenConnection();
            str_mac = "select trim(id_data) from " + ll_pace + ".sys_parameter where inv_org = '" + str_inv + "' and id = " + i_no.ToString().Trim();
            command.CommandText = str_mac;
            ds = dbCenter.ExecuteQuery(command);
            if (ds.Tables[0].Rows.Count > 0) //说明找到 
            {
                str_mac = ds.Tables[0].Rows[0][0].ToString().Trim();
                str_ip = "";
                IPAddress[] localIPs;
                Response.Write("1" + str_mac);
                localIPs = Dns.GetHostAddresses(str_mac);
                Response.Write("2");
                foreach (IPAddress ip in localIPs)
                {
                    //根据AddressFamily判断是否为ipv4,如果是InterNetWork则为ipv6
                    if (ip.AddressFamily == AddressFamily.InterNetwork)
                    {
                        str_ip = ip.ToString().Trim();
                        break;
                    }
                }
                Response.Write("3" + str_ip);
                if (str_ip == "")
                {
                    str_return = "";
                }
                else
                {
                    str_return = str_mac.Trim() + str_ip.Trim();
                }
            }
            else //没有找到 
            {
                str_return = "";
            }
        }
        catch (System.Exception ee)
        {
            Response.Write(ee.ToString());
            throw;
        }
        finally
        {
            dbCenter.CloseConnection();
        }
        return str_return;
    }


    public void vvv_confirm_asnno(string s_org, DataSet ds_asn, string str_userid)
    {
        string s_str, s_pallet_flag, s_pa_flag, s_sugg_loc, s_asntype, s_taxdist;
        int i_rec_no;
        DataSet ds_sku;
        SqlCommand command;
        command = new SqlCommand();
        SqlDatabaseController SqldbCenter = new SqlDatabaseController();
        try
        {
            SqldbCenter.OpenConnection();
            SqldbCenter.BeginTransaction();
            //得到是否上架计算的参数
            s_str = "select isnull(id_data,'0') from " + ll_pace + ".sys_parameter where inv_org = '" + s_org + "' and id = 8102";
            s_pa_flag = test.Sql_exec_selectstring(s_str);
            //循环进行收货确认
            for (int i = 0; i < ds_asn.Tables[0].Rows.Count; i++)
            {
                if (System.Convert.ToDecimal(ds_asn.Tables[0].Rows[i]["prerec_qty_m"].ToString().Trim()) != 0) //说明有收货数
                {
                    //得到最大行号
                    s_str = "select isnull(max(receive_line_no),0) from " + ll_pace + ".asn_receive_detail where inv_org = '" + s_org + "' and consignor = '" + ds_asn.Tables[0].Rows[i]["consignor"].ToString().Trim() + "' " +
                            "and asn_no ='" + ds_asn.Tables[0].Rows[i]["asn_no"].ToString().Trim() + "' and asn_line_no =" + ds_asn.Tables[0].Rows[i]["asn_line_no"].ToString().Trim();
                    command.CommandText = s_str;
                    i_rec_no = SqldbCenter.ExecuteScalar(command);
                    i_rec_no = i_rec_no + 1;

                    //判断该商品是托盘管理还是非托盘管理
                    s_str = "select isnull(a.pallet_flag,'0') pallet_flag,b.asn_type,c.tax_dist from " + ll_pace + ".mst_sku a," + ll_pace + ".asn_order_header b," + ll_pace + ".asn_order_detail c where a.inv_org = '" + s_org + "' and a.consignor = '" + ds_asn.Tables[0].Rows[i]["consignor"].ToString().Trim() +
                           "' and a.sku = '" + ds_asn.Tables[0].Rows[i]["sku"].ToString().Trim() + "' and a.inv_org = c.inv_org and a.consignor = c.consignor and a.sku = c.sku and c.inv_org = b.inv_org and c.consignor = b.consignor and c.asn_no = b.asn_no";
                    command.CommandText = s_str;
                    ds_sku = SqldbCenter.ExecuteQuery(command);
                    s_asntype = ds_sku.Tables[0].Rows[0]["asn_type"].ToString().Trim();
                    s_taxdist = ds_sku.Tables[0].Rows[0]["tax_dist"].ToString().Trim();
                    s_pallet_flag = ds_sku.Tables[0].Rows[0]["pallet_flag"].ToString().Trim();
                    //插入收货数据
                    s_str = "insert into " + ll_pace + ".asn_receive_detail(	inv_org,consignor,	asn_no,		asn_line_no,	receive_line_no,       sku,		pack_code,	order_price,	order_unit," +
                                                    "cubage,		gross_weight,	net_weight,	shelflife_day,	receive_qty_m,	receive_qty_s,	receive_present_qty_m,	receive_present_qty_s," +
                                                    "main_sub_flag,	convert_modulus,	receive_day,	fact_status,	lot_attribute1,	lot_attribute2,	lot_attribute3,	lot_attribute4," +
                                                    "lot_attribute5,	lot_attribute6,	lot_attribute7,	lot_attribute8,	lot_attribute9,	lot_attribute10,	lot_attribute11,	lot_attribute12," +
                                                    "lot_attribute13,	lot_attribute14,	lot_attribute15,standby_1,standby_2,standby_3,standby_4,standby_5,standby_6,standby_7,memo,main_dist,made_time,maker)" +
                            "values('" + s_org + "','" + ds_asn.Tables[0].Rows[i]["consignor"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["asn_no"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["asn_line_no"].ToString().Trim() + "," +
                            System.Convert.ToString(i_rec_no) + ",'" + ds_asn.Tables[0].Rows[i]["sku"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["pack_code"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["order_price"].ToString().Trim() + ",'" +
                            ds_asn.Tables[0].Rows[i]["order_unit"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["prerec_cubage"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_gross"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_net"].ToString().Trim() + "," +
                            ds_asn.Tables[0].Rows[i]["shelflife_day"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_qty_m"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_qty_s"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_present_qty_m"].ToString().Trim() + "," +
                            ds_asn.Tables[0].Rows[i]["prerec_present_qty_s"].ToString().Trim() + ",'" + ds_asn.Tables[0].Rows[i]["main_sub_flag"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["convert_modulus"].ToString().Trim() + ",'" + DateTime.Now.ToString("yyyy.MM.dd") + "',";
                    if (s_pallet_flag == "0")  //非托盘管理，直接插入拆板，并且状态是拆板
                        s_str = s_str + "'1',";
                    else  //托盘，不拆板，状态是收货确认
                        s_str = s_str + "'0',";
                    s_str = s_str + "'" + ds_asn.Tables[0].Rows[i]["lot_attribute1"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute2"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute3"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute4"].ToString().Trim() + "','" +
                        ds_asn.Tables[0].Rows[i]["lot_attribute5"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute6"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute7"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute8"].ToString().Trim() + "','" +
                        ds_asn.Tables[0].Rows[i]["lot_attribute9"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute10"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute11"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute12"].ToString().Trim() + "','" +
                        ds_asn.Tables[0].Rows[i]["lot_attribute13"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute14"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute15"].ToString().Trim() + "','','','','','',0,0,'" + ds_asn.Tables[0].Rows[i]["memo"].ToString().Trim() + "','A',getdate(),'" + str_userid + "')";
                    command.CommandText = s_str;
                    SqldbCenter.ExecuteNonQuery(command);
                    //如果是非托盘，插入拆版数据
                    if (s_pallet_flag == "0")
                    {
                        s_str = "insert into " + ll_pace + ".asn_pallet_split(inv_org,consignor,	asn_no,		asn_line_no,	receive_line_no,	pallet_no,	sku,		pack_code,	order_price,order_unit," +
                                                                "pallet_qty_m,	pallet_qty_s,	main_sub_flag,	convert_modulus,	shelflife_day, cubage,		gross_weight," +
                                                                "net_weight,	spliter,	split_status,	split_date,	lot_attribute1,	lot_attribute2,	lot_attribute3,	lot_attribute4," +
                                                                "lot_attribute5,	lot_attribute6,	lot_attribute7,	lot_attribute8,	lot_attribute9,	lot_attribute10,	lot_attribute11,	lot_attribute12," +
                                                                "lot_attribute13,	lot_attribute14,	lot_attribute15,	standby_1,	standby_2,	standby_3,	standby_4,	standby_5," +
                                                                "standby_6,	standby_7,	memo,		main_dist,	made_time,	maker)" +
                                "values('" + s_org + "','" + ds_asn.Tables[0].Rows[i]["consignor"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["asn_no"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["asn_line_no"].ToString().Trim() + "," +
                                System.Convert.ToString(i_rec_no) + ",'000000000000000','" + ds_asn.Tables[0].Rows[i]["sku"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["pack_code"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["order_price"].ToString().Trim() + ",'" + ds_asn.Tables[0].Rows[i]["order_unit"].ToString().Trim() + "'," +
                                System.Convert.ToString(System.Convert.ToDecimal(ds_asn.Tables[0].Rows[i]["prerec_qty_m"].ToString().Trim()) + System.Convert.ToDecimal(ds_asn.Tables[0].Rows[i]["prerec_present_qty_m"].ToString().Trim())) + "," +
                                System.Convert.ToString(System.Convert.ToDecimal(ds_asn.Tables[0].Rows[i]["prerec_qty_s"].ToString().Trim()) + System.Convert.ToDecimal(ds_asn.Tables[0].Rows[i]["prerec_present_qty_s"].ToString().Trim())) + ",'" +
                                ds_asn.Tables[0].Rows[i]["main_sub_flag"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["convert_modulus"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["shelflife_day"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_cubage"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_gross"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_net"].ToString().Trim() + ",'" +
                                str_userid + "','0','" + DateTime.Now.ToString("yyyy.MM.dd") + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute1"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute2"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute3"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute4"].ToString().Trim() + "','" +
                            ds_asn.Tables[0].Rows[i]["lot_attribute5"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute6"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute7"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute8"].ToString().Trim() + "','" +
                            ds_asn.Tables[0].Rows[i]["lot_attribute9"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute10"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute11"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute12"].ToString().Trim() + "','" +
                            ds_asn.Tables[0].Rows[i]["lot_attribute13"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute14"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute15"].ToString().Trim() + "','','','','','',0,0,'" + ds_asn.Tables[0].Rows[i]["memo"].ToString().Trim() + "','A',getdate(),'" + str_userid + "')";
                        command.CommandText = s_str;
                        SqldbCenter.ExecuteNonQuery(command);
                    }
                    //如果是非托盘管理并且不需要上架计算,直接插入上架计算表
                    //2012.05.25针对鑫马非托盘管理,收货后是否直接插入上架计算表
                    if (s_pa_flag == "1") //直接插入上架计算表
                    {
                        //得到相应商品的有库存的库位
                        //s_asntype, s_taxdist;location_flag
                        s_str = "select isnull(max(a.location_code),'') from " + ll_pace + ".inv_sku_location a," + ll_pace + ".mst_location b where a.inv_org = '" + s_org + "' and a.consignor = '" + ds_asn.Tables[0].Rows[i]["consignor"].ToString().Trim() + "' and a.sku = '" + ds_asn.Tables[0].Rows[i]["sku"].ToString().Trim() + "' and a.pack_code = '" +
                                ds_asn.Tables[0].Rows[i]["pack_code"].ToString().Trim() + "' and a.inv_org = b.inv_org and a.location_code = b.location_code and b.lock_flag = '0'";
                        if (s_asntype == "3") //寄售
                        {
                            s_str = s_str + " and b.location_flag = '3'";
                        }
                        else
                        {
                            s_str = s_str + " and b.location_flag = '0'";
                        }
                        if (s_taxdist.Trim() == "保税") //保税区分
                        {
                            s_str = s_str + " and b.standby_flag1 = '1'";
                        }
                        else
                        {
                            s_str = s_str + " and b.standby_flag1 = '0'";
                        }
                        s_sugg_loc = test.Sql_exec_selectstring(s_str);
                        s_str = "insert into " + ll_pace + ".asn_putaway(inv_org,	consignor,	asn_no,		asn_line_no," +
                                                                           "receive_line_no,	pallet_no,	sku,		pack_code," +
                                                                           "order_price,	order_unit,	putaway_qty_m,	putaway_qty_s," +
                                                                           "main_sub_flag,	convert_modulus,	suggest_location,	shelflife_day," +
                                                                           "cubage,		gross_weight,	net_weight,	putaway_status," +
                                                                           "fact_location,	putawayer,	putaway_flag,	putaway_date," +
                                                                           "print_flag,	printer,	label_flag," +
                                                                           "labeler,	lot_attribute1,	lot_attribute2," +
                                                                           "lot_attribute3,	lot_attribute4,	lot_attribute5,	lot_attribute6," +
                                                                           "lot_attribute7,	lot_attribute8,	lot_attribute9,	lot_attribute10," +
                                                                           "lot_attribute11,	lot_attribute12,	lot_attribute13,	lot_attribute14," +
                                                                           "lot_attribute15,	standby_1,	standby_2,	standby_3," +
                                                                           "standby_4,	standby_5,	standby_6,	standby_7," +
                                                                           "memo,		main_dist,	made_time,	maker) " +
                                " values('" + s_org + "','" + ds_asn.Tables[0].Rows[i]["consignor"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["asn_no"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["asn_line_no"].ToString().Trim() + "," +
                                System.Convert.ToString(i_rec_no) + ",'000000000000000','" + ds_asn.Tables[0].Rows[i]["sku"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["pack_code"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["order_price"].ToString().Trim() + ",'" + ds_asn.Tables[0].Rows[i]["order_unit"].ToString().Trim() + "'," +
                                System.Convert.ToString(System.Convert.ToDecimal(ds_asn.Tables[0].Rows[i]["prerec_qty_m"].ToString().Trim()) + System.Convert.ToDecimal(ds_asn.Tables[0].Rows[i]["prerec_present_qty_m"].ToString().Trim())) + "," +
                                System.Convert.ToString(System.Convert.ToDecimal(ds_asn.Tables[0].Rows[i]["prerec_qty_s"].ToString().Trim()) + System.Convert.ToDecimal(ds_asn.Tables[0].Rows[i]["prerec_present_qty_s"].ToString().Trim())) + ",'" +
                                ds_asn.Tables[0].Rows[i]["main_sub_flag"].ToString().Trim() + "'," + ds_asn.Tables[0].Rows[i]["convert_modulus"].ToString().Trim() + ",'" + s_sugg_loc + "'," + ds_asn.Tables[0].Rows[i]["shelflife_day"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_cubage"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_gross"].ToString().Trim() + "," + ds_asn.Tables[0].Rows[i]["prerec_net"].ToString().Trim() + "," +
                                "'0','','','1','','0','','0','','" + ds_asn.Tables[0].Rows[i]["lot_attribute1"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute2"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute3"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute4"].ToString().Trim() + "','" +
                            ds_asn.Tables[0].Rows[i]["lot_attribute5"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute6"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute7"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute8"].ToString().Trim() + "','" +
                            ds_asn.Tables[0].Rows[i]["lot_attribute9"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute10"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute11"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute12"].ToString().Trim() + "','" +
                            ds_asn.Tables[0].Rows[i]["lot_attribute13"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute14"].ToString().Trim() + "','" + ds_asn.Tables[0].Rows[i]["lot_attribute15"].ToString().Trim() + "','','','','','',0,0,'" + ds_asn.Tables[0].Rows[i]["memo"].ToString().Trim() + "','A',getdate(),'" + str_userid + "')";
                        command.CommandText = s_str;
                        SqldbCenter.ExecuteNonQuery(command);
                    }
                    //修改订单明细的状态
                    s_str = "update " + ll_pace + ".asn_order_detail set receive_qty_m = isnull(receive_qty_m,0) + " + ds_asn.Tables[0].Rows[i]["prerec_qty_m"].ToString().Trim() + "," +
                                                                       "receive_qty_s = isnull(receive_qty_s,0) + " + ds_asn.Tables[0].Rows[i]["prerec_qty_s"].ToString().Trim() + "," +
                                                                       "receive_present_qty_m = isnull(receive_present_qty_m,0) + " + ds_asn.Tables[0].Rows[i]["prerec_present_qty_m"].ToString().Trim() + "," +
                                                                       "receive_present_qty_s = isnull(receive_present_qty_s,0) + " + ds_asn.Tables[0].Rows[i]["prerec_present_qty_s"].ToString().Trim() + "," +
                                                                       "receive_day = case ltrim(rtrim(isnull(receive_day,''))) when '' then '" + DateTime.Now.ToString("yyyy.MM.dd") + "' else receive_day end," +
                                                                       "receive_status = case when isnull(receive_qty_m,0) +" + ds_asn.Tables[0].Rows[i]["prerec_qty_m"].ToString().Trim() + " >= isnull(order_qty_m,0) then '2' else '1' end," +
                                                                       "main_dist = 'C',update_time = getdate(),updater='" + str_userid + "' where inv_org = '" + s_org + "' and consignor = '" + ds_asn.Tables[0].Rows[i]["consignor"].ToString().Trim() + "' and " +
                                                                       "asn_no='" + ds_asn.Tables[0].Rows[i]["asn_no"].ToString().Trim() + "' and asn_line_no =" + ds_asn.Tables[0].Rows[i]["asn_line_no"].ToString().Trim();
                    command.CommandText = s_str;
                    SqldbCenter.ExecuteNonQuery(command);
                }
                //全部更新完成后修改表头的状态
                s_str = "select count(*) from " + ll_pace + ".asn_order_detail where inv_org = '" + s_org + "' and consignor = '" + ds_asn.Tables[0].Rows[0]["consignor"].ToString().Trim() + "' and asn_no ='" + ds_asn.Tables[0].Rows[0]["asn_no"].ToString().Trim() + "' and receive_status in ('0','1')";
                command.CommandText = s_str;
                i_rec_no = SqldbCenter.ExecuteScalar(command);
                s_str = "update " + ll_pace + ".asn_order_header set arrive_day = case ltrim(rtrim(isnull(arrive_day,''))) when '' then '" + DateTime.Now.ToString("yyyy.MM.dd") + "' else arrive_day end,";
                if (i_rec_no > 0)//说明还没有收完
                    s_str = s_str + "arrive_status = '1',";
                else
                    s_str = s_str + "arrive_status = '2',";
                s_str = s_str + "main_dist = 'C',update_time=getdate(),updater='" + str_userid + "' where inv_org = '" + s_org + "' and consignor = '" + ds_asn.Tables[0].Rows[0]["consignor"].ToString().Trim() + "' and asn_no ='" + ds_asn.Tables[0].Rows[0]["asn_no"].ToString().Trim() + "'";
                command.CommandText = s_str;
                SqldbCenter.ExecuteNonQuery(command);
            }
            SqldbCenter.Commit();
        }
        catch (System.Exception)
        {
            SqldbCenter.Rollback();
            throw;
        }
        finally
        {
            SqldbCenter.CloseConnection();
        }
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        string lkl;
        DataSet ds = new DataSet();
        try
        {
            string g_usql;
            g_usql = "select a.asn_line_no,a.sku,a.order_qty_m,'未到' receive_status ,a.order_qty_s,a.present_qty_m,a.present_qty_s,a.receive_qty_m,a.receive_qty_s,a.receive_present_qty_m,a.receive_present_qty_s," +
                   "3 prerec_qty_m,3 prerec_qty_s,0.0000 prerec_present_qty_m,0.0000 prerec_present_qty_s,a.receive_day,a.inv_org,a.consignor,a.asn_no,a.shelflife_day,a.pack_code,a.order_price,a.order_unit," +
                   "a.main_sub_flag,a.convert_modulus,'' lot_attribute1,'2012.10.26' lot_attribute2,'非保税' lot_attribute3,'AN00000010' lot_attribute4,'' lot_attribute5,'' lot_attribute6,'' lot_attribute7,'' lot_attribute8," +
                   "'' lot_attribute9,'' lot_attribute10,'' lot_attribute11,'' lot_attribute12,'' lot_attribute13,'' lot_attribute14,'' lot_attribute15," +
                   "0.0000 prerec_cubage,0.0000 prerec_gross,0.0000 prerec_net,b.beyond_rate,a.cubage,a.gross_weight,a.net_weight,a.memo,a.receive_status,a.tax_dist,'0' lot_flag,a.batchno,isnull(a.standby_1,'') standby_1,isnull(a.standby_2,'') standby_2,isnull(a.standby_6,0) standby_6,isnull(a.standby_7,0) standby_7 from " + ll_pace + ".asn_order_detail a," + ll_pace + ".mst_sku b where " +
                   "a.inv_org = '01.01.002.01' and a.consignor = 'XM001' and a.asn_no = 'AN00000010' and a.inv_org = b.inv_org and a.consignor = b.consignor and a.sku = b.sku order by a.asn_line_no";
            ds = test.Sql_exec_selectsql(g_usql);
            //string dd;
            //dd = f_get_ip("01.01.002.01", 1002);
            vvv_confirm_asnno("01.01.002.01", ds, "111");
        }
        catch(System.Exception ee)
        {
            lkl = ee.Message.ToString().Trim();
        }
    }


}
